﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class Building
{
    #region Static Variables

    private static int buildingCount = 0;

    #endregion

    #region Member Variables

    public BuildingType type = BuildingType.Empty;
    public Orientation orientation = Orientation.South;
    public BuildingSize size = BuildingSize.Size1x1;
    public int areaOfEffect = 1;

    private int id = 0;

    #endregion

    #region Enumerations

    public enum BuildingSize 
    {
        Size1x1,
        Size1x2,
        Size2x2
    }

    public enum BuildingType
    {
        Empty,
        EmptyRubble,
        Banks,
        BigBoxStore,
        BusinessPark,
        Capital,
        Church,
        Communications,
        Courthouse,
        Factory,
        Farm,
        FireStation,
        Fuel,
        GreenPower,
        Hospital,
        House,
        Library,
        Lumber,
        Mining,
        Museum,
        Park,
        PoliceStation,
        PowerStation,
        PrimarySchool,
        Prison,
        Ranch,
        Restaurants,
        SecondarySchool,
        Stadium,
        Suburban,
        Textiles,
        Theater,
        Urban,
        Warehouse,
        Waste,
        WaterPlant,
        Zoo,
        GroceryStore
    }

    public enum Orientation
    {
        South = 0,
        East = 1,
        North = 2,
        West = 3
    }

    #endregion

    #region Constructors

    public Building(BuildingType type, Orientation orientation)
    {
        this.type = type;
        switch (type)
        {
            case BuildingType.Banks:
                this.size = BuildingSize.Size1x1;
                this.areaOfEffect = 1;
                break;
            case BuildingType.BigBoxStore:
                this.size = BuildingSize.Size1x2;
                this.areaOfEffect = 2;
                break;
            case BuildingType.BusinessPark:
                this.size = BuildingSize.Size1x2;
                this.areaOfEffect = 1;
                break;
            case BuildingType.Capital:
                this.size = BuildingSize.Size1x1;
                this.areaOfEffect = 2;
                break;
            case BuildingType.Church:
                this.size = BuildingSize.Size1x1;
                this.areaOfEffect = 1;
                break;
            case BuildingType.Communications:
                this.size = BuildingSize.Size1x2;
                this.areaOfEffect = 2;
                break;
            case BuildingType.Courthouse:
                this.size = BuildingSize.Size1x1;
                this.areaOfEffect = 1;
                break;
            case BuildingType.Empty:
                this.size = BuildingSize.Size1x1;
                this.areaOfEffect = 1;
                break;
            case BuildingType.EmptyRubble:
                this.size = BuildingSize.Size1x1;
                this.areaOfEffect = 1;
                break;
            case BuildingType.Factory:
                this.size = BuildingSize.Size1x1;
                this.areaOfEffect = 2;
                break;
            case BuildingType.Farm:
                this.size = BuildingSize.Size2x2;
                this.areaOfEffect = 3;
                break;
            case BuildingType.FireStation:
                this.size = BuildingSize.Size1x1;
                this.areaOfEffect = 4;
                break;
            case BuildingType.Fuel:
                this.size = BuildingSize.Size1x1;
                this.areaOfEffect = 2;
                break;
            case BuildingType.GreenPower:
                this.size = BuildingSize.Size1x1;
                this.areaOfEffect = 2;
                break;
            case BuildingType.Hospital:
                this.size = BuildingSize.Size1x2;
                this.areaOfEffect = 3;
                break;
            case BuildingType.House:
                this.size = BuildingSize.Size1x1;
                this.areaOfEffect = 1;
                break;
            case BuildingType.Library:
                this.size = BuildingSize.Size1x1;
                this.areaOfEffect = 1;
                break;
            case BuildingType.Lumber:
                this.size = BuildingSize.Size1x2;
                this.areaOfEffect = 2;
                break;
            case BuildingType.Mining:
                this.size = BuildingSize.Size1x2;
                this.areaOfEffect = 2;
                break;
            case BuildingType.Museum:
                this.size = BuildingSize.Size1x1;
                this.areaOfEffect = 1;
                break;
            case BuildingType.Park:
                this.size = BuildingSize.Size1x2;
                this.areaOfEffect = 1;
                break;
            case BuildingType.PoliceStation:
                this.size = BuildingSize.Size1x1;
                this.areaOfEffect = 4;
                break;
            case BuildingType.PowerStation:
                this.size = BuildingSize.Size1x1;
                this.areaOfEffect = 2;
                break;
            case BuildingType.PrimarySchool:
                this.size = BuildingSize.Size1x1;
                this.areaOfEffect = 1;
                break;
            case BuildingType.Prison:
                this.size = BuildingSize.Size1x1;
                this.areaOfEffect = 3;
                break;
            case BuildingType.Ranch:
                this.size = BuildingSize.Size2x2;
                this.areaOfEffect = 3;
                break;
            case BuildingType.Restaurants:
                this.size = BuildingSize.Size1x1;
                this.areaOfEffect = 1;
                break;
            case BuildingType.SecondarySchool:
                this.size = BuildingSize.Size2x2;
                this.areaOfEffect = 2;
                break;
            case BuildingType.Stadium:
                this.size = BuildingSize.Size1x2;
                this.areaOfEffect = 1;
                break;
            case BuildingType.Suburban:
                this.size = BuildingSize.Size1x2;
                this.areaOfEffect = 2;
                break;
            case BuildingType.Textiles:
                this.size = BuildingSize.Size1x1;
                this.areaOfEffect = 2;
                break;
            case BuildingType.Theater:
                this.size = BuildingSize.Size1x1;
                this.areaOfEffect = 1;
                break;
            case BuildingType.Urban:
                this.size = BuildingSize.Size1x1;
                this.areaOfEffect = 2;
                break;
            case BuildingType.Warehouse:
                this.size = BuildingSize.Size1x2;
                this.areaOfEffect = 2;
                break;
            case BuildingType.Waste:
                this.size = BuildingSize.Size1x2;
                this.areaOfEffect = 3;
                break;
            case BuildingType.WaterPlant:
                this.size = BuildingSize.Size1x1;
                this.areaOfEffect = 2;
                break;
            case BuildingType.Zoo:
                this.size = BuildingSize.Size2x2;
                this.areaOfEffect = 1;
                break;
        }
        this.orientation = orientation;
        this.id = Building.buildingCount++;
    }

    #endregion

    #region Public Methods

    public int GetId()
    {
        return id;
    }

    #endregion

}
